<template>
  <div id="app">
    <Topbar :key="topBarKeyValue"></Topbar>
    <Header></Header>
    <router-view @checkKey="topBarKeyValue++" />
    <transition>
      <Toast v-show="isShowToast"></Toast>
    </transition>
    <Footer></Footer>
    <Login v-show="isShowLoginModal"></Login>
  </div>
</template>

<script>
import Topbar from "@/components/MyTopbar";
import Header from "@/components/Header";
import Footer from "@/components/Footer";
import Login from "@/components/Login";
import Toast from "@/components/Toast.vue";
import { mapState } from "vuex";

export default {
  data() {
    return {
      topBarKeyValue: 0,
    };
  },
  computed: {
    ...mapState({
      isShowLoginModal: (state) => state.showModal.isShowLoginModal,
      isShowToast: (state) => state.showToast.isShowToast,
    }),
  },
  components: {
    Topbar,
    Header,
    Footer,
    Login,
    Toast,
  },
  created() {
    console.log("环境变量为:", process.env.VUE_APP_BASE_URL);
    console.log("环境变量为:", process.env.VUE_APP_MY_NAME);
  },
};
</script>
<style lang="less">
.slide-enter,
.slide-leave-to {
  opacity: 0;
}

.slide-enter-active,
.slide-leave-active {
  transition: opacity 0.3s linear;
}

.slide-enter-to,
.slide-leave {
  opacity: 1;
}
</style>
